'use strict';

const Controller = require('egg').Controller;

class ArticleController extends Controller {
  async lists() {
    const { ctx } = this;
    var result = await ctx.service.add.list()
    console.log(result)
    ctx.body = result;
    
  }

  async add() {
    const { ctx } = this;

    const result = await ctx.service.article.add(params);

    if (result) {
      ctx.body = {
        status: 200,
        data: result,
      };
    } else {
      ctx.body = {
        status: 500,
        errMsg: '发布文章失败',
      };
    }

    
  }



}

module.exports = ArticleController;


